Functions List


Constructive Solid Geometry


union

The function union computes the union (U0 ∪ U1) between a specified number of shapes. The union operation is commutative so the shapes can be specified in any order.

Parameters:

s1, s2. s3. s4, …, sn – Shapes for union operation

Syntax:

(union s1 s2 s3 s4 … sn)
(union (list s1 s2 s3 s4 … sn))

Example:

> (let ((cube (box (xyz 0 0 0) (xyz 1 1 1)))
      (sphere (sphere (xyz 0 1 1) 0.5)))
  (union cube sphere))
#<delayed-union 2 ...>



intersection

The function intersection computes the intersection (U0 ∩ U1) between a specified number of shapes. The intersection operation is commutative so the shapes can be specified in any order.

Parameters:

s1, s2. s3. s4, …, sn – Shapes for intersection operation

Syntax:

(intersection s1 s2 s3 s4 … sn)
(intersection (list s1 s2 s3 s4 … sn))

Example:

> (let ((cube (box (xyz 0 0 0) (xyz 1 1 1)))
      (sphere (sphere (xyz 0 1 1) 0.5)))
  (intersection cube sphere))
#<intersection 2>



subtraction

The function subtraction computes the difference (U0 \ U1) between a specified number of shapes. The subtraction operation is NOT commutative so the shapes should be specified in the correct order – first the shape to subtract from followed by the shapes that will be subtracted to the first.

Parameters:

s1, s2. s3. s4, …, sn – Shapes for subtraction operation

Syntax:

(subtraction s1 s2 s3 s4 … sn)
(subtraction (list s1 s2 s3 s4 … sn))

Example:

> (let ((cube (box (xyz 4 0 0) (xyz 5 1 1)))
      (sphere (sphere (xyz 4 1 1) 0.5)))
  (subtraction cube sphere))
#<subtraction 2>



empty-shape

The function empty-shape defines the empty set or shape that can be used as the neutral/identity element of union and subtraction operations.

Parameters:

n/a

Syntax:

(empty-shape)

Example:

> (empty-shape)
#<empty shape>



universal-shape

The function universal-shape defines the set that contains all objects, including itself. It can be used as the neutral/identity element for intersection operations.

Parameters:

n/a

Syntax:

(universal-shape)

Example:

> (universal-shape)
#<universal shape>
Top